<script setup lang="ts">
/**
 * @desc SubprocessNode
 * @author MiyueFE <https://github.com/miyuesc>
 * @since 2024/7/12 上午10:07
 */

import type { PropType } from 'vue'
import { SquareParking } from 'lucide-vue-next'
import type { FlowDirection, SubprocessNode } from '@/types'

defineOptions({ name: 'SubprocessNode' })
defineProps({
  data: {
    type: Object as PropType<SubprocessNode>,
    required: true,
  },
  direction: {
    type: String as PropType<FlowDirection>,
    default: 'vertical',
    validator: (v: FlowDirection) => ['vertical', 'horizontal'].includes(v),
  },
})
defineEmits(['update:data'])
</script>

<template>
  <div class="flow-node flow-subprocess">
    <div
      class="flow-node_header"
    >
      <SquareParking :size="16" />
      <span>{{ data.name }}</span>
    </div>
    <DingFlowList
      :data="data.$start!"
      :direction="direction"
    />
  </div>
</template>
